package cn.blunce.Enumeration;

import java.util.Enumeration;
import java.util.Vector;

/**
 * Created by Experiment on 2016/6/23 0023.
 */
public class Expmt_Enumeration {
    public static void main(String[] args) {
        Vector v = new Vector();
        for (int i = 0; i < 3; i++)
            v.addElement(new Hamster(i));
        Printer.printAll(v.elements());
    }
}

class Hamster {
    private int hamsterNumber;

    Hamster(int i) {
        hamsterNumber = i;
    }

    public String toString() {
        return "This is Hamster #" + hamsterNumber;
    }
}

class Printer {
    static void printAll(Enumeration e) {
        while (e.hasMoreElements())
            System.out.println(
                    e.nextElement().toString());
    }
}